#include "MyMath.h"

Vector3f Normalize(const Vector3f &v)
{
	Vector3f result;
	float magnitude = sqrtf(v.x * v.x + v.y * v.y + v.z * v.z);
	result.x = v.x/magnitude;
	result.y = v.y/magnitude;
	result.z = v.z/magnitude;
	return result;
}
Vector3f Cross(const Vector3f &u, const Vector3f &v)
{
	Vector3f result;
	result.x = u.y*v.z - u.z*v.y;
	result.y = u.z*v.x - u.x*v.z;
	result.z = u.x*v.y - u.y*v.x;
	return result;
}
float Dot(const Vector3f &u, const Vector3f &v)
{
	return u.x*v.x + u.y*v.y+u.z*v.z;
}